package dormouse.vfs.metadata;

import org.apache.commons.vfs2.FileObject;

import dormouse.vfs.event.IFileSelectionListener;
import dormouse.vfs.ui.renderers.IFileRenderer;

/**
 * This class defines the methods needed by the metadata viewer. Implementations
 * of this class should read the metadata of the file, and display both the
 * metadata and the file preview component..
 * 
 * @param <C>
 *            the preview component class (should extend java.awt.Component if
 *            this is Swing)
 */
public interface IMetadataViewer<C> extends IFileSelectionListener {

	final String DEFAULT = "DEFAULT";

	/**
	 * This method displays the metadata from the file. It should get a
	 * IMetadataReader from the MetadataFactory and then render the metadata.
	 * 
	 * @param file
	 *            the file whose metadata should be viewed.
	 */
	void preview(FileObject file);

	/**
	 * This method gets the preview component, and should be called by the
	 * implementation of the {@link #preview} method.
	 * 
	 * @param file
	 *            The file to be previewed.
	 * @return
	 */
	IFileRenderer<C> getPreviewComponent(FileObject file);

	/**
	 * Gets the renderable component.
	 * 
	 * @return a metadata viewer component
	 */
	C getComponent();

	/**
	 * Gets the supported file extensions.
	 * 
	 * @return an array of file extendions.
	 */
	String[] getExtensions();

}
